﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<skags.Models.ForumThreadAnswerViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Spjallið - <%: Model.Title %>
</asp:Content>


<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="main">
    <h2><%: Html.ActionLink("Spjallið", "Index") %> - <%: Model.Title %> | <a href="/Forum/Category/<%=Model.CategoryID%>"><%: Model.CategoryName %></a></h2>
    
    <p> Svör eftir fagaðila birtast efst með fjólubláum bakgrunn. </p>

    <br />
    <p>Spurning:</p>
    <fieldset>
        <legend>
       <% if (HttpContext.Current.User.Identity.Name == Model.UserName) {%>
            
                <a href="/Forum/DeleteThread/<%=Model.ThreadID%>" ><img src="../../Content/icons/delete.png" alt="Eyða" /></a>
                <a href="/Forum/Edit/<%=Model.ThreadID%>"><img src="../../Content/icons/edit.png" alt="Breyta" /></a>
                
            <% }%> <b><%: Model.Title %></b>, eftir <a href="/Profile/User/<%= Model.AuthorID %>"><%= Model.UserName %></a> - <%: String.Format("{0:g}", Model.DateCreated) %>
            <a href="/Forum/ThreadAbuse/<%=Model.ThreadID%>"> <img src="../../Content/images/flag-red-small.png" alt="Láta vita af óviðeigandi efni" /></a>
        </legend>
        
        <div class="threadtext"><%= Model.ThreadText %></div>
        
        </fieldset>
        <br /><br />


<div class="answers">
           Svör:<br />
           <% foreach (var item in Model.Answers)
              {%>
                <% if (item.UserRole == "Fagfolk") { %>
            <br />
            <div class="fagsvar">
            <fieldset>
                
              <legend>
              <% if ((HttpContext.Current.User.Identity.Name == item.UserName) || (HttpContext.Current.User.IsInRole("Admin"))) {%>
            
                <a href="/Forum/DeleteAnswer/<%=item.ID%>" onclick="return confirm('Ertu viss um að þú viljir eyða þessu svari?')"><img src="../../Content/icons/delete.png" alt="Eyða" /></a>
                
                
            <% }%>
              <a href="/Profile/User/<%= item.UserIntID %>"><%= item.FullName %></a> - <%:String.Format("{0:g}", item.DateCreated)%>
              </legend>
           
            <div class="answer"><%= item.Answer%></div>
                
            </fieldset>
            </div>

            
          <%}%>
          <%}%>


            <% foreach (var otheritem in Model.Answers)
              {%>
                <% if (otheritem.UserRole != "Fagfolk") { %>
            <br />
            
            <fieldset>
                
              <legend>
              <% if ((HttpContext.Current.User.Identity.Name == otheritem.UserName) || (HttpContext.Current.User.IsInRole("Admin"))) {%>
            
                <a href="/Forum/DeleteAnswer/<%=otheritem.ID%>" onclick="return confirm('Ertu viss um að þú viljir eyða þessu svari?')"><img src="../../Content/icons/delete.png" alt="Eyða" /></a>
                
                
            <% }%>
               
              <a href="/Profile/User/<%= otheritem.UserIntID %>"><%= otheritem.UserName %></a> - <%:String.Format("{0:g}", otheritem.DateCreated)%>
               <a href="/Forum/AnswerAbuse/<%=otheritem.ID%>"> <img src="../../Content/images/flag-red-small.png" alt="Láta vita af óviðeigandi efni" /></a>
              </legend>
           
            <div class="answer"><%= otheritem.Answer%></div>
                
            </fieldset>
            

          <%}%>
          <%}%>
    <p>
        <%: Html.ActionLink("Svara", "CreateAnswer", new { id = Model.ThreadID })%>
    </p>

</div>
</div>
</asp:Content>

